<%--
  Created by IntelliJ IDEA.
  User: 11875
  Date: 2021/10/18
  Time: 10:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>学生列表</title>
    <link rel="stylesheet" href="/css/homepageheder.css">
    <link rel="stylesheet" href="/css/tradmilsit.css">
    <link rel="stylesheet" href="/css/classlist.css">
    <link rel="stylesheet" href="/css/bootstrap.css">
    <link rel="stylesheet" href="/css/homepage.css">
</head>
<body>
<div class="heder">
    <div class="title">
        <div class="title_t">
            <span>宿 舍 管 理 系 统</span>
        </div>
        <div class="title_r">
            欢迎您！！！
            <c:if test="${user.typeid == 1}">
                班主任老师
            </c:if>
            <c:if test="${user.typeid == 2}">
                宿管老师
            </c:if>
            ${user.uname}
            <span>|</span>
            <a href="javascript:history.go(-1)">返回上一页</a>
            <span>|</span>
            <a href="/user/main">返回主页</a>
            <span>|</span>
            <a href="/user/updatepasswordpage">修改密码</a>
            <span>|</span>
            <a href="/user/logout">退出</a>
        </div>
    </div>
</div>

<!-- 列表 -->
<div id="table">
    <div class="table_title clearfix">
        <c:if test="${user.typeid == 1}">
            <h2>${classes.cname}学生列表</h2>
            <div class="table_search">
                <form class="form-inline my-2 my-lg-0" action="/student/studentsbysnameandmobile">
                    <input type="hidden" name="cid" value="${classes.cid}">
                    <input class="form-control mr-sm-2" type="search" name="sname" placeholder="输入学生名姓名"
                           aria-label="Search">
                    <input class="form-control mr-sm-2" type="search" name="mobile" placeholder="输入手机号"
                           aria-label="Search">
                    <button class="btn btn-outline-success my-2 my-sm-0" type="submit">搜索</button>
                </form>
            </div>
        </c:if>
        <c:if test="${user.typeid == 2}">
            <h2>${room.rname}学生列表</h2>
            <div class="table_search">
                <form class="form-inline my-2 my-lg-0" action="/student/studentsbysnameandmobile">
                    <input type="hidden" name="rid" value="${room.rid}">
                    <input class="form-control mr-sm-2" type="search" name="sname" placeholder="输入学生名姓名"
                           aria-label="Search">
                    <input class="form-control mr-sm-2" type="search" name="mobile" placeholder="输入手机号"
                           aria-label="Search">
                    <button class="btn btn-outline-success my-2 my-sm-0" type="submit">搜索</button>
                </form>
            </div>
        </c:if>
    </div>
    <table class="table table-bordered table-hover">
        <thead>
        <tr>
            <th scope="col">姓名</th>
            <th scope="col">性别</th>
            <th scope="col">电话</th>
            <th scope="col">生日</th>
            <th scope="col">状态</th>
            <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:if test="${studentList.size()==0}">
            <tr>
                <td colspan="6">没有管理的学生</td>
            </tr>
        </c:if>
        <c:forEach items="${studentList }" var="students">
            <tr>
                <th scope="row">${students.sname}</th>
                <td>${students.sex}</td>
                <td>${students.mobile}</td>
                <td><fmt:formatDate value="${students.birthday}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                <td>${students.cstatus==1?"在读":"毕业"}</td>
                <td>
                    <a href="/student/studentdetail/${students.sid}" class="btn btn-info"><i
                            class="bi bi-info-circle"></i>详情</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>


<div class="clearfix addclass">
    <button type="button" class="btn btn-primary">
        <a href="/student/addstudentpage/${cid}">点击添加新的学生</a>
    </button>
</div>


<script src="/js/jquery-3.6.0.min.js"></script>
<script src="/js/bootstrap.js"></script>
</body>
</html>
